package Semester_1.LIst;

import java.util.Iterator;
import java.util.LinkedList;

public class LInkedlist {
    public static void main(String[] args) {
        LinkedList<String> ll=new LinkedList<String>();
        ll.add("hello");
        ll.add("word");
        ll.add("java");
        for(String s:ll){
            System.out.println(s);
        }
        System.out.println("-------------------");
        Iterator<String> it = ll.listIterator();
        while(it.hasNext()){
            String s=it.next();
            System.out.println(s);
        }
        System.out.println("-------------------");
        for(int i=0;i<ll.size();i++){
            String s=ll.get(i);
            System.out.println(s);
        }
    }
}
